package site.beanyon.now.model.dto;

import site.beanyon.now.model.po.TimeSpanPO;

/**
 * 时间区间传输描述类
 */
public class TimeSpanDTO {
    /**
     * 主键id
     */
    private Integer id;

    /**
     * 开始时间
     */
    private Long startTime;

    /**
     * 结束时间
     */
    private Long endTime;

    public TimeSpanDTO(TimeSpanPO timeSpanPO) {
        this.id = timeSpanPO.getId();
        this.startTime = timeSpanPO.getStartTime().getTime();
        this.endTime = timeSpanPO.getEndTime() == null ? 0 : timeSpanPO.getEndTime().getTime();
    }

    public TimeSpanDTO(Long startTime, Long endTime, Integer cardId) {
        this.startTime = startTime;
        this.endTime = endTime;
    }

    public TimeSpanDTO(Integer id, Long startTime, Long endTime) {
        this.id = id;
        this.startTime = startTime;
        this.endTime = endTime;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Long getStartTime() {
        return startTime;
    }

    public void setStartTime(Long startTime) {
        this.startTime = startTime;
    }

    public Long getEndTime() {
        return endTime;
    }

    public void setEndTime(Long endTime) {
        this.endTime = endTime;
    }

    @Override
    public String toString() {
        return "TimeSpanDTO{" +
                "id=" + id +
                ", startTime=" + startTime +
                ", endTime=" + endTime +
                '}';
    }
}
